import java.util.Scanner;
public class Loop_4 {
    public static void main(String[] args){
        Scanner reader = new Scanner(System.in);
        System.out.print("请输入正方形的边长：");
        int length = reader.nextInt();

        for (int i = 1;i <= length;i++){
            for (int j = 1;j <= length; j++){
                if(i > 1 && i < length){
                    if(j > 1 && j < length){
                        System.out.print("   ");
                    }
                    else{
                        System.out.print(" * ");
                    }
                }
                else{
                    System.out.print(" * ");
                }
            }
            System.out.println(" ");
        }
    }
}

